package com.companyName.generator;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by guojun on 2016/4/1.
 */
public class ReplaceMap {
    static Map  replaceMap = new HashMap<>();

    static{
        replaceMap.put("<!-- dubboxjar dubbo replace -->","<!-- dubbo start -->\n" +
                "\t\t<dependency>\n" +
                "\t\t\t<groupId>com.alibaba</groupId>\n" +
                "\t\t\t<artifactId>dubbo</artifactId>\n" +
                "\t\t\t<version>2.8.4</version>\n" +
                "\t\t\t<exclusions>\n" +
                "\t\t\t\t<exclusion>\n" +
                "\t\t\t\t\t<artifactId>curator-framework</artifactId>\n" +
                "\t\t\t\t\t<groupId>org.apache.curator</groupId>\n" +
                "\t\t\t\t</exclusion>\n" +
                "\t\t\t\t<exclusion>\n" +
                "\t\t\t\t\t<artifactId>curator-client</artifactId>\n" +
                "\t\t\t\t\t<groupId>org.apache.curator</groupId>\n" +
                "\t\t\t\t</exclusion>\n" +
                "\t\t\t\t<exclusion>\n" +
                "\t\t\t\t\t<artifactId>guava</artifactId>\n" +
                "\t\t\t\t\t<groupId>com.google.guava</groupId>\n" +
                "\t\t\t\t</exclusion>\n" +
                "\t\t\t\t<exclusion>\n" +
                "\t\t\t\t\t<artifactId>spring-web</artifactId>\n" +
                "\t\t\t\t\t<groupId>org.springframework</groupId>\n" +
                "\t\t\t\t</exclusion>\n" +
                "\t\t\t\t<exclusion>\n" +
                "\t\t\t\t\t<artifactId>org.slf4j</artifactId>\n" +
                "\t\t\t\t\t<groupId>slf4j-api</groupId>\n" +
                "\t\t\t\t</exclusion>\n" +
                "\t\t\t\t<exclusion>\n" +
                "\t\t\t\t\t<artifactId>commons-logging</artifactId>\n" +
                "\t\t\t\t\t<groupId>commons-logging</groupId>\n" +
                "\t\t\t\t</exclusion>\n" +
                "\t\t\t</exclusions>\n" +
                "\t\t</dependency>\n" +
                "\t\t<dependency>\n" +
                "\t\t\t<groupId>javax.servlet</groupId>\n" +
                "\t\t\t<artifactId>jstl</artifactId>\n" +
                "\t\t</dependency>\n" +
                "\t\t<!-- dubbo end -->");
        replaceMap.put("<!-- zookeeperjar dubbo replace -->","<!-- zookeeper start -->\n" +
                "\t\t<dependency>\n" +
                "\t\t\t<groupId>org.apache.zookeeper</groupId>\n" +
                "\t\t\t<artifactId>zookeeper</artifactId>\n" +
                "\t\t\t<version>3.4.6</version>\n" +
                "\t\t\t<exclusions>\n" +
                "\t\t\t\t<exclusion>\n" +
                "\t\t\t\t\t<artifactId>slf4j-log4j12</artifactId>\n" +
                "\t\t\t\t\t<groupId>org.slf4j</groupId>\n" +
                "\t\t\t\t</exclusion>\n" +
                "\t\t\t</exclusions>\n" +
                "\t\t</dependency>\n" +
                "\t\t<dependency>\n" +
                "\t\t\t<groupId>com.github.sgroschupf</groupId>\n" +
                "\t\t\t<artifactId>zkclient</artifactId>\n" +
                "\t\t\t<version>0.1</version>\n" +
                "\t\t</dependency>\n" +
                "\t\t<!-- zookeeper end -->");


        replaceMap.put("<!-- starter-web dubbo replace -->","<dependency>\n" +
                "\t\t\t<groupId>org.springframework.boot</groupId>\n" +
                "\t\t\t<artifactId>spring-boot-starter-web</artifactId>\n" +
                "\t\t</dependency>");

        replaceMap.put("<!-- hessianjar hessian replace -->","<dependency>\n" +
                "\t\t<groupId>com.caucho</groupId>\n" +
                "\t\t<artifactId>hessian</artifactId>\n" +
                "\t\t<version>4.0.7</version>\n" +
                "\t</dependency>");

        replaceMap.put("<!-- starter-web hessian replace -->","<dependency>\n" +
                "\t\t\t<groupId>org.springframework.boot</groupId>\n" +
                "\t\t\t<artifactId>spring-boot-starter-web</artifactId>\n" +
                "\t\t</dependency>");

        replaceMap.put("<!-- catjar cat replace -->","");
        replaceMap.put("<!-- mqjar rabbitmq replace -->","");


    }

    public static String getReplaceContent(String key){
        String ret = (String)replaceMap.get(key);
        if (ret == null || "".equals(ret)){
            ret = key;
        }
        return ret;
    }

    public static void main(String[] args) {
        String ss = ReplaceMap.getReplaceContent("<!-- zookeeper replace -->");
        System.out.print("baaaa".indexOf("a"));
    }
}
